tags = {
    name: "cinemas",
    description: "影院管理模块",
};
schemas = {
   cinemas:{
    properties: {
        _id: {
            type: "string",
            description: "唯一标识",
        },
        name: {
            type: "string",
            description: "影院名",
        },
       
        iphone: {
            type: "string",
            description: "联系方式",
        },
        address: {
            type: "string",
            description: "联系地址",
        },
      
    }
   },
    ArrayOfcinemas: {
        properties: {
            total: {
                type: "number",
                description: "总数",
            },
            maxPage: {
                type: "number",
                description: "总页数",
            },
            rows: {
                type: "array",
                description: "影院",
                items: {
                    $ref: "#/components/schemas/cinemas",
                },
            },
        },
    },
    addCinemas: {
        properties: {
            _id: {
                type: "string",
                description: "唯一标识",
            },
            name: {
                type: "string",
                description: "影院名字",
            },  
            phone: {
                type: "string",
                description: "联系电话",
            }, 
            address: {
                type: "string",
                description: "影院地址",
            }, 
            status: {
                type: "boolean",
                description: "是否营业，true 为营业，false 为休息",
            }, 
        },
    },
}

paths = {
    "/cinemas": {
        get: {
            tags: ["cinemas"],
            summary: "获取影院信息",
            description: "",
            consumes: ["application/json"],
            // 参数
            parameters: [
                {
                    name: "curPage",
                    in: "query",
                    schema: {
                        type: "integer",
                        default: 1,
                    },
                    required: true,
                    description: "当前页码",
                },
                {
                    name: "eachPage",
                    in: "query",
                    schema: {
                        type: "integer",
                        default: 1,
                    },
                    required: true,
                    description: "每页条数",
                },
            ],
            responses: {
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/ArrayOfcinemas",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
            },
        },
    },
    "/cinemas/add": {
        post: {
            tags: ["cinemas"],
            summary: "添加影院",
            description: "这是一个添加影院功能",
            // 请求的数据类型 json
            consumes: ["application/json"],
            // 请求参数
            requestBody: {
                // 必填
                required: true,
                // 内容
                content: {
                    "application/json": {
                        // 结构
                        schema: {
                            $ref: "#/components/schemas/addCinemas",
                        },
                        example: {
                            name: "太平洋影院",
                            phone: "123456",
                            address:"成都",
                            status:"true",
                        },
                    },
                },
            },
            responses: {
                // http 状态码
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/cinemas",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
                500: {
                    description: "服务端内部错误",
                },
            },
        },
    },
}
module.exports = { tags, schemas, paths };